import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目',
    align: "center",
    dataIndex: 'projectId_dictText'
  },
  {
    title: '系统',
    align: "center",
    dataIndex: 'projectSystemId_dictText'
  },
  {
    title: '框架/预研',
    align: "center",
    dataIndex: 'projectType_dictText'
  },
  {
    title: '批次',
    align: "center",
    dataIndex: 'batchId_dictText'
  },
  {
    title: '评审阶段',
    align: "center",
    dataIndex: 'reviewStage_dictText'
  },
  {
    title: '评审物',
    align: "center",
    dataIndex: 'reviewContent_dictText'
  },
  {
    title: '发起人',
    align: "center",
    dataIndex: 'promoter_dictText'
  },
  {
    title: '测试',
    align: "center",
    dataIndex: 'participator_dictText'
  },
  {
    title: '产品',
    align: "center",
    dataIndex: 'prodParticipator_dictText'
  },
  {
    title: '开发',
    align: "center",
    dataIndex: 'devParticipator_dictText'
  },
  {
    title: '问题数量',
    align: "center",
    dataIndex: 'numberIssues'
  },
  {
    title: '开始时间',
    align: "center",
    dataIndex: 'startTime'
  },
  {
    title: '结束时间',
    align: "center",
    dataIndex: 'finishTime'
  },
  {
    title: '评审结果',
    align: "center",
    dataIndex: 'meetingResult_dictText'
  },
  {
    title: '会议文件',
    align: "center",
    dataIndex: 'meetintFile',
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "项目",
    field: 'projectId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_project,project_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "系统",
    field: 'projectSystemId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_project_system,system_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "框架/预研",
    field: 'projectType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "project_type"
    },
    //colProps: {span: 6},
  },
  {
    label: "批次",
    field: 'batchId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_project_batch,batch_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "评审阶段",
    field: 'reviewStage',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_stage"
    },
    //colProps: {span: 6},
  },
  {
    label: "评审物",
    field: 'reviewContent',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_content"
    },
    //colProps: {span: 6},
  },
  {
    label: "评审结果",
    field: 'meetingResult',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_result"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目',
    field: 'projectId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_project,project_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目!'},
             ];
    },
  },
  {
    label: '系统',
    field: 'projectSystemId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_project_system,system_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入系统!'},
             ];
    },
  },
  {
    label: '框架/预研',
    field: 'projectType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "project_type"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入框架/预研!'},
             ];
    },
  },
  {
    label: '批次',
    field: 'batchId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_project_batch,batch_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入批次!'},
             ];
    },
  },
  {
    label: '评审阶段',
    field: 'reviewStage',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_stage"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入评审阶段!'},
             ];
    },
  },
  {
    label: '评审物',
    field: 'reviewContent',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_content"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入评审物!'},
             ];
    },
  },
  {
    label: '发起人',
    field: 'promoter',
    component: 'JSelectUser',
    componentProps:{
      labelKey: 'realname',
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入发起人!'},
             ];
    },
  },
  {
    label: '测试',
    field: 'participator',
    component: 'JSelectUser',
    componentProps:{
      labelKey: 'realname',
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入测试!'},
             ];
    },
  },
  {
    label: '产品',
    field: 'prodParticipator',
    component: 'JSelectUser',
    componentProps:{
      labelKey: 'realname',
    },
  },
  {
    label: '开发',
    field: 'devParticipator',
    component: 'JSelectUser',
    componentProps:{
      labelKey: 'realname',
    },
  },
  {
    label: '问题数量',
    field: 'numberIssues',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入问题数量!'},
             ];
    },
  },
  {
    label: '开始时间',
    field: 'startTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入开始时间!'},
             ];
    },
  },
  {
    label: '结束时间',
    field: 'finishTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入结束时间!'},
             ];
    },
  },
  {
    label: '评审结果',
    field: 'meetingResult',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "review_result"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入评审结果!'},
             ];
    },
  },
  {
    label: '会议纪要',
    field: 'meetingContent',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入会议纪要!'},
             ];
    },
  },
  {
    label: '会议文件',
    field: 'meetintFile',
    component: 'JUpload',
    componentProps:{
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  projectId: {title: '项目',order: 0,view: 'list', type: 'string',dictTable: "tm_project", dictCode: 'id', dictText: 'project_name',},
  projectSystemId: {title: '系统',order: 1,view: 'list', type: 'string',dictTable: "tm_project_system", dictCode: 'id', dictText: 'system_name',},
  projectType: {title: '框架/预研',order: 2,view: 'list', type: 'string',dictCode: 'project_type',},
  batchId: {title: '批次',order: 3,view: 'list', type: 'string',dictTable: "tm_project_batch", dictCode: 'id', dictText: 'batch_name',},
  reviewStage: {title: '评审阶段',order: 4,view: 'list', type: 'string',dictCode: 'review_stage',},
  reviewContent: {title: '评审物',order: 5,view: 'list', type: 'string',dictCode: 'review_content',},
  promoter: {title: '发起人',order: 6,view: 'sel_user', type: 'string',},
  participator: {title: '测试',order: 7,view: 'sel_user', type: 'string',},
  prodParticipator: {title: '产品',order: 8,view: 'sel_user', type: 'string',},
  devParticipator: {title: '开发',order: 9,view: 'sel_user', type: 'string',},
  numberIssues: {title: '问题数量',order: 10,view: 'text', type: 'string',},
  startTime: {title: '开始时间',order: 11,view: 'datetime', type: 'string',},
  finishTime: {title: '结束时间',order: 12,view: 'datetime', type: 'string',},
  meetingResult: {title: '评审结果',order: 13,view: 'list', type: 'string',dictCode: 'review_result',},
  meetintFile: {title: '会议文件',order: 15,view: 'file', type: 'string',},
};
